<extend name="Base/base" />
<block name='head'> 
    <link rel="stylesheet" type="text/css" href="/Public/Index/css/plan_css.css">
    <link rel="stylesheet" type="text/css" href="/Public/Index/css/slick.css">
    <script type="text/javascript" src="/Public/Index/js/jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="/Public/Index/js/slick.min.js"></script>
    <title>全部计划</title>
    <style>
        .plan_nr{margin-left:5px}
        .plan_nr, .noread_flag{position: relative}
        .readFlag{width:7px;height:7px;border-radius: 50%;background: #F74339;display: inline-block;position: absolute;top:10px;left:-8px}
        .countFlag{top:12px;left:10px}
    </style>
</block>
<block name="content" > 
    <div class="attention_plan">
        <if condition="$saff == 0">
            <div class="all_plans">
                <ul class="idTabs scroll-navigation">
                    <li <if condition="$deptStype == 0">class="allday"</if> data-id="0" data-dept="0"><a class="pointer">本人</a></li>
                    <notempty name='dept'>
                        <foreach name='dept' item='dp' key='dp_id'>
                            <if condition="$dp neq null">
                                <li data-id="{$dp.dept_id}" data-dept="{$dp.dept_id}" <if condition="$deptStype == $dp['dept_id']">class="allday"</if>><a class="pointer">{$dp.dept_name}</a></li>
                            </if>
                        </foreach>
                    </notempty>
                </ul>
            </div>
            <else/>
            <div id="wrapper">
                <input type='hidden' id="data-dept" value="0"> 
            </div>
        </if>
        <div class="all_plan_lists">
            <section class="plans_nr" id="tab1">
                <div class="st-container">
                    <ul class="attention_plan_bt">
                        <li class="pointer {$cType == 0 ? 'current' : ''} noread_flag" data-type="0">
                            <span>{$total}</span><br/>全部
                            <!--                            <if condition="$allNoRead eq 1">
                                                        <span class="readFlag countFlag"></span>
                                                        </if>-->
                        </li>
                        <foreach name="counts" item="count" key="key">
                            <if condition="$cType == 0 && ($key == 0)">
                                <li class="pointer noread_flag" data-type="{$count.type_id}">
                                    <span class="count">{$count.count}</span><br/>{$count.type_name}
                                <if condition="$count['noRead'] eq 1">
                                    <span class="readFlag countFlag"></span>
                                </if>
                                </li>
                                <else/>
                                <li class="pointer <if condition='$cType == $count[type_id]'>current</if> noread_flag" data-type="{$count.type_id}">
                                    <span>{$count.count}</span><br/>{$count.type_name}
                                <if condition="$count['noRead'] eq 1">
                                    <span class="readFlag countFlag"></span>
                                </if>
                                </li>
                            </if>
                        </foreach>
                    </ul>
                    <div class="st-scroll">
                        <section class="st-panel" id="rab1">
                            <ul class="new_plan_lists" style="margin-bottom: 48px">
                                <notempty name="allPlan">
                                    <foreach name="allPlan" item="week" key="plan_id">
                                        <li data-type="">
                                            <a class="planInfo pointer" data-id="{$week.plan_id}" data-dept="{$week.plan_id}" <if condition="$week[end_date] lt $week[today] and $week[end_date] neq '0000-00-00'">style="color:#ED8D76"</if>>
                                                <span class="plan_nr">{$plan_id+1}.{$week.name}
                                                    <if condition="$week['noRead'] == 1">
                                                        <span class="readFlag"></span>
                                                    </if>
                                                </span>
                                                <span class="plan_att_num">{$week.total_percent}%</span>
                                            </a>
                                            <span class="collect">
                                                <a href="#"><i class="icon-guanzhu" data-id="{$week.plan_id}"></i></a>
                                            </span>
                                        </li>
                                    </foreach>
                                    <else />
                                    <li><a href="#"><span class="plan_nr">暂无数据</span></a></li>
                                </notempty>
                            </ul> 
                        </section>
                        <input type="hidden" name="dept_id" value="{$deptStype|default=0}">
                        <input type='hidden' id="followUrl" value="{:U('attentPlan')}">
                    </div> 
                </div> 
            </section>
        </div> 
    </div>
    <div class="plan_bottom">
        <ul>
            <li><a href="attentionPlan.html"><span class="plan_icon">&#xe624;</span>关注计划({$followCount|default=0})</a></li>
            <li><a href="allPlans.html"><span class="plan_icon">&#xe65b;</span>我的计划({$allCount|default=0})</a></li>
        </ul>
    </div>
</block>
<block name="script">
    <script type="text/javascript" src="/Public/Index/js/planNew.js"></script>
    <script type="text/javascript" src="/Public/Index/js/layer.js"></script>
    <script type="text/javascript">
        $(initAllPlan());
        $(initFollow());
        //动态加计划详情url
        $(function () {
            $('body .st-scroll').on('click', '.planInfo', function () {
                //var id = $(this).attr('data-dept');
                var id = $(this).attr('data-id');
                var dept = '';
                var cType = '';
                dept = $('#data-dept').val();
                if (dept != 'undefined') {
                    $('body').find('.idTabs li').each(function () {
                        if ($(this).hasClass('allday') == true) {
                            dept = $(this).attr('data-dept');
                        }
                    })
                }else{
                    dept == 0;
                }
                $('body').find('.attention_plan_bt li').each(function () {
                    if ($(this).hasClass('current')) {
                        cType = $(this).attr('data-type');
                    }
                })
             
                location.href = '/index.php/Index/Plan/show/id/' + id + '/dept/' + dept + '/cType/' + cType;
            })
        })

        $('.scroll-navigation').slick({
            dots: false,
            infinite: false,
            speed: 300,
            slidesToShow: 1,
            centerMode: false,
            variableWidth: true,
            arrows: false
        });

    </script>
</block>
